package com.talos.ums.dal.mysql.userstation;

import com.talos.framework.common.pojo.PageResult;
import com.talos.framework.mybatis.core.mapper.BaseMapperX;
import com.talos.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.talos.ums.controller.admin.userstation.vo.UmsUserStationPageReqVO;
import com.talos.ums.dal.dataobject.userstation.UmsUserStationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用站点关联表 Mapper
 *
 * @author ${table.author}
 */
@Mapper
public interface UmsUserStationMapper extends BaseMapperX<UmsUserStationDO> {

    default PageResult<UmsUserStationDO> selectPage(UmsUserStationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UmsUserStationDO>()
                .eqIfPresent(UmsUserStationDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UmsUserStationDO::getStationId, reqVO.getStationId())
                .betweenIfPresent(UmsUserStationDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UmsUserStationDO::getCreatorCode, reqVO.getCreatorCode())
                .likeIfPresent(UmsUserStationDO::getCreatorName, reqVO.getCreatorName())
                .betweenIfPresent(UmsUserStationDO::getModifyTime, reqVO.getModifyTime())
                .eqIfPresent(UmsUserStationDO::getModifierCode, reqVO.getModifierCode())
                .likeIfPresent(UmsUserStationDO::getModifierName, reqVO.getModifierName())
                .eqIfPresent(UmsUserStationDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(UmsUserStationDO::getId));
    }

}
